<template>
    <div>
        <el-table :data="store.getters['member/getMemberList']" border style="width: 100%">
            <el-table-column prop="id" label="用户编号" width="180">
            </el-table-column>
            <el-table-column prop="nickname" label="昵称" width="180">
            </el-table-column>
            <el-table-column prop="phone" label="手机号">
            </el-table-column>
            <el-table-column label="状态">
                <template v-slot="item">
                    <div>
                        <el-tag v-if="item.row.status == 1" type="success">启用</el-tag>
                        <el-tag v-else type="danger">禁用</el-tag>
                    </div>
                </template>
            </el-table-column>
            <el-table-column label="操作">
                <template v-slot="item">
                    <div>
                        <el-button type="primary" size="small" @click="edit(item.row.uid)">编辑</el-button>
                    </div>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>
<script lang='ts' setup>
import { defineEmits } from 'vue'
import { useStore } from 'vuex'
let store = useStore()

const emit = defineEmits(['edit'])
//封装一个编辑菜单事件
const edit = (uid: number) => {
    emit('edit', uid)
}

const getMember = () => {
    store.dispatch('member/getMemberListAction')
}
getMember()
</script>
<style lang='less' scoped>
.el-table {
    margin-top: 20px;
}
</style>